/**
 * 这里是使用class和对象的形式实现的， 队列就需要有两个tag位置了。
 */

class Stack {
    constructor() {
        this.data = {}
        this.count = 0
    }


    push(value) {
        this.data[this.count] = value
        this.count++
    }

    pop() {
        const res = this.data[this.count]
        delete this.data[this.count]
        this.count--
        return res
    }

    getMin() {
        let min = this.data[0];
        for (let k in this.data) {
            if (min > this.data[k]) {
                min = this.data[k]
            }
        }
        return min
    }
}


function minStackV2() {
    this.data = []
}

minStackV2.prototype.push = (value) => {
    this.data[this.data.length] = value
}
minStackV2.prototype.pop = () => {
    const res = this.data[this.data.length]
    this.data.length--
    return res
}
minStackV2.prototype.getMin = () => {
    const len = this.data.length
    let min = this.data[0]

    for (let item of this.data) {
        if (min > item) {
            min = item
        }
    }
    return min
}






